home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / libg_261.zip / libg_261 / configure < prev    next >
Text File  |  1994-10-20  |  33KB  |  1,017 lines

  1. #!/bin/sh
  2.  
  3. ### WARNING: this file contains embedded tabs.  Do not run untabify on this file.
  4.  
  5. # Configuration script
  6. # Copyright (C) 1988, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
  7.  
  8. # This program is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation; either version 2 of the License, or
  11. # (at your option) any later version.
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. # GNU General Public License for more details.
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. # Please report any problems running this configure script to
  21. # configure@cygnus.com
  22. # Please do not send reports about other problems to this address.  See
  23. # gdb/README, gas/README, etc., for info on where and how to report
  24. # problems about particular tools.
  25.  
  26. # This file was written by K. Richard Pixley.
  27.  
  28. #
  29. # Shell script to create proper links to machine-dependent files in
  30. # preparation for compilation.
  31. #
  32. # If configure succeeds, it leaves its status in config.status.
  33. # If configure fails after disturbing the status quo, 
  34. #       config.status is removed.
  35. #
  36.  
  37. export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0 $argv; kill $$)
  38.  
  39. remove=rm
  40. hard_link=ln
  41. symbolic_link='ln -s'
  42.  
  43. #for Test
  44. #remove="echo rm"
  45. #hard_link="echo ln"
  46. #symbolic_link="echo ln -s"
  47.  
  48. # clear some things potentially inherited from environment.
  49.  
  50. Makefile=Makefile
  51. Makefile_in=Makefile.in
  52. arguments=$*
  53. build_alias=
  54. configdirs=
  55. exec_prefix=
  56. exec_prefixoption=
  57. fatal=
  58. floating_point=default
  59. gas=default
  60. host_alias=NOHOST
  61. host_makefile_frag=
  62. moveifchange=
  63. norecursion=
  64. other_options=
  65. package_makefile_frag=
  66. prefix=/usr/local
  67. progname=
  68. program_prefix=
  69. program_prefixoption=
  70. program_suffix=
  71. program_suffixoption=
  72. program_transform_name=
  73. program_transform_nameoption=
  74. redirect=">/dev/null"
  75. removing=
  76. site=
  77. site_makefile_frag=
  78. site_option=
  79. srcdir=
  80. srctrigger=
  81. subdirs=
  82. target_alias=NOTARGET
  83. target_makefile_frag=
  84. undefs=NOUNDEFS
  85. version="$Revision: 1.198 $"
  86. x11=default
  87.  
  88. ### we might need to use some other shell than /bin/sh for running subshells
  89. #
  90. config_shell=${CONFIG_SHELL-/bin/sh}
  91.  
  92. NO_EDIT="This file was generated automatically by configure.  Do not edit."
  93.  
  94. ## this is a little touchy and won't always work, but...
  95. ##
  96. ## if the argv[0] starts with a slash then it is an absolute name that can (and
  97. ## must) be used as is.
  98. ##
  99. ## otherwise, if argv[0] has no slash in it, we can assume that it is on the
  100. ## path.  Since PATH might include "." we also add `pwd` to the end of PATH.
  101. ##
  102.  
  103. progname=$0
  104. # if PWD already has a value, it is probably wrong.
  105. if [ -n "$PWD" ]; then PWD=`pwd`; fi
  106.  
  107. case "${progname}" in
  108. /*) ;;
  109. */*) ;;
  110. *)
  111.         PATH=$PATH:${PWD=`pwd`} ; export PATH
  112.         ;;
  113. esac
  114.  
  115. # Loop over all args
  116.  
  117. while :
  118. do
  119.  
  120. # Break out if there are no more args
  121.     case $# in
  122.     0)
  123.         break
  124.         ;;
  125.     esac
  126.  
  127. # Get the first arg, and shuffle
  128.     option=$1
  129.     shift
  130.  
  131. # Make all options have two hyphens
  132.     orig_option=$option    # Save original for error messages
  133.     case $option in
  134.     --*) ;;
  135.     -*) option=-$option ;;
  136.     esac
  137.         
  138. # Split out the argument for options that take them
  139.     case $option in
  140.     --*=*)
  141.         optarg=`echo $option | sed -e 's/^[^=]*=//'`
  142.         ;;
  143. # These options have mandatory values.  Since we didn't find an = sign,
  144. # the value must be in the next argument
  145.     --b* | --cache* | --ex* | --ho* | --pre* | --program-p* | --program-s* | --program-t* | --si* | --sr* | --ta* | --tm* | --x-*)
  146.         optarg=$1
  147.         shift
  148.         ;;
  149.     esac
  150.  
  151. # Now, process the options
  152.     case $option in
  153.  
  154.     --build* | --b*)
  155.         case "$build_alias" in
  156.         "") build_alias=$optarg ;;
  157.         *) echo '***' Can only configure for one build machine at a time.  1>&2
  158.            fatal=yes
  159.            ;;
  160.         esac
  161.         ;;
  162. # Accepted for compatibility with new autoconf; ignored.
  163.     --cache*)
  164.         ;;
  165.     --disable-*)
  166.         enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
  167.         eval $enableopt=no
  168.         disableoptions="$disableoptions $option"
  169.         ;;
  170.     --enable-*)
  171.         case "$option" in
  172.         *=*)    ;;
  173.         *)    optarg=yes ;;
  174.         esac
  175.  
  176.         enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
  177.         eval $enableopt="$optarg"
  178.         enableoptions="$enableoptions $option"
  179.         ;;
  180.     --exec-prefix* | --ex*)
  181.         exec_prefix=$optarg
  182.         exec_prefixoption="--exec-prefix=$optarg"
  183.         ;;
  184.     --gas | --g*)
  185.         gas=yes
  186.         ;;
  187.     --help | --he*)
  188.         fatal=yes
  189.         ;;
  190.     --host* | --ho*)
  191.         case $host_alias in
  192.         NOHOST) host_alias=$optarg ;;
  193.         *) echo '***' Can only configure for one host at a time.  1>&2
  194.            fatal=yes
  195.            ;;
  196.         esac
  197.         ;;
  198.     --nfp | --nf*)
  199.         floating_point=no
  200.         ;;
  201.     --norecursion | --no*)
  202.         norecursion=yes
  203.         ;;
  204.     --prefix* | --pre*)
  205.         prefix=$optarg
  206.         prefixoption="--prefix=$optarg"
  207.         ;;
  208.     --program-prefix* | --program-p*)
  209.         program_prefix=$optarg
  210.         program_prefixoption="--program-prefix=$optarg"
  211.         ;;
  212.     --program-suffix* | --program-s*)
  213.         program_suffix=$optarg
  214.         program_suffixoption="--program-suffix=$optarg"
  215.         ;;
  216.     --program-transform-name* | --program-t*)
  217.         # Double any backslashes or dollar signs in the argument
  218.         program_transform_name="${program_transform_name} -e `echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
  219.         program_transform_nameoption="${program_transform_nameoption} --program-transform-name='$optarg'"
  220.         ;;
  221.     --rm)
  222.         removing=--rm
  223.         ;;
  224.     --silent | --sil* | --quiet | --q*)
  225.         redirect=">/dev/null"
  226.         verbose=--silent
  227.         ;;
  228.     --site* | --sit*)
  229.         site=$optarg
  230.         site_option="--site=$optarg"
  231.         ;;
  232.     --srcdir*/ | --sr*/)
  233.                 # Remove trailing slashes.  Otherwise, when the file name gets
  234.                 # bolted into an object file as debug info, it has two slashes
  235.                 # in it.  Ordinarily this is ok, but emacs takes double slash
  236.                 # to mean "forget the first part".
  237.         srcdir=`echo $optarg | sed -e 's:/$::'`
  238.         ;;
  239.     --srcdir* | --sr*)
  240.         srcdir=$optarg
  241.         ;;
  242.     --target* | --ta*)
  243.         case $target_alias in
  244.         NOTARGET) target_alias=$optarg ;;
  245.         *) echo '***' Can only configure for one target at a time.  1>&2
  246.            fatal=yes
  247.            ;;
  248.         esac
  249.         ;;
  250.     --tmpdir* | --tm*)
  251.         TMPDIR=$optarg
  252.         tmpdiroption="--tmpdir=$optarg"
  253.         ;;
  254.     --verbose | --v | --verb*)
  255.         redirect=
  256.         verbose=--verbose
  257.         ;;
  258.     --version | --V | --vers*)
  259.         echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
  260.         exit 0
  261.         ;;
  262.     --with-*)
  263.         case "$option" in
  264.         *=*)    ;;
  265.         *)    optarg=yes ;;
  266.         esac
  267.  
  268.         withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
  269.         eval $withopt="$optarg"
  270.         withoptions="$withoptions $option"
  271.         ;;
  272.     --without-*)
  273.         withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
  274.         eval $withopt=no
  275.         withoutoptions="$withoutoptions $option"
  276.         ;;
  277.     --x)    with_x=yes
  278.         withoptions="$withoptions --with-x"
  279.         ;;
  280.     --x-i* | --x-l*) other_options="$other_options $orig_option"
  281.         ;;
  282.     --*)
  283.         echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
  284.         exit 1
  285.         ;;
  286.     *)
  287.         case $undefs in
  288.         NOUNDEFS) undefs=$option ;;
  289.         *) echo '***' Can only configure for one host and one target at a time.  1>&2
  290.            fatal=yes
  291.            ;;
  292.         esac
  293.         ;;
  294.     esac
  295. done
  296.  
  297. # process host and target
  298.  
  299. # Do some error checking and defaulting for the host and target type.
  300. # The inputs are:
  301. #    configure --host=HOST --target=TARGET UNDEFS
  302. #
  303. # The rules are:
  304. # 1. You aren't allowed to specify --host, --target, and undefs at the
  305. #    same time.
  306. # 2. Host defaults to undefs.
  307. # 3. If undefs is not specified, then host defaults to the current host,
  308. #    as determined by config.guess.
  309. # 4. Target defaults to undefs.
  310. # 5. If undefs is not specified, then target defaults to host.
  311.  
  312. case "${fatal}" in
  313. "")
  314.     # Make sure that host, target & undefs aren't all specified at the
  315.     # same time.
  316.     case $host_alias---$target_alias---$undefs in
  317.     NOHOST---*---* | *---NOTARGET---* | *---*---NOUNDEFS)
  318.         ;;
  319.     *) echo '***' Can only configure for one host and one target at a time.  1>&2
  320.        fatal=yes
  321.        break 2
  322.         ;;
  323.     esac
  324.  
  325.     # Now, do defaulting for host.
  326.     case $host_alias in
  327.     NOHOST)
  328.         case $undefs in
  329.         NOUNDEFS)
  330.             # Neither --host option nor undefs were present.
  331.             # Call config.guess.
  332.             guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
  333.             if host_alias=`${guesssys}`
  334.             then
  335.                 # If the string we are going to use for
  336.                 # the target is a prefix of the string
  337.                 # we just guessed for the host, then
  338.                 # assume we are running native, and force
  339.                 # the same string for both target and host.
  340.                 case $target_alias in
  341.                 NOTARGET) ;;
  342.                 *)
  343.                     if expr $host_alias : $target_alias >/dev/null
  344.                     then
  345.                         host_alias=$target_alias
  346.                     fi
  347.                     ;;
  348.                 esac
  349.                 echo "Configuring for a ${host_alias} host." 1>&2
  350.                 arguments="--host=$host_alias $arguments"
  351.             else
  352.                 echo 'Config.guess failed to determine the host type.  You need to specify one.' 1>&2
  353.                 fatal=yes
  354.             fi
  355.             ;;
  356.         *)
  357.             host_alias=$undefs
  358.             ;;
  359.         esac
  360.     esac
  361.  
  362.     # Do defaulting for target.  If --target option isn't present, default
  363.     # to undefs.  If undefs isn't present, default to host.
  364.     case $target_alias in
  365.     NOTARGET)
  366.         case $undefs in
  367.         NOUNDEFS)
  368.             target_alias=$host_alias
  369.             ;;
  370.         *)
  371.             target_alias=$undefs
  372.             ;;
  373.         esac
  374.     esac
  375.     ;;
  376. *) ;;
  377. esac
  378.  
  379. if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
  380.     exec 1>&2
  381.     echo Usage: configure [OPTIONS] [HOST]
  382.     echo
  383.     echo Options: [defaults in brackets]
  384.     echo ' --prefix=MYDIR         install into MYDIR [/usr/local]'
  385.     echo ' --exec-prefix=MYDIR     install host-dependent files into MYDIR [/usr/local]'
  386.     echo ' --help             print this message [normal config]'
  387.     echo ' --build=BUILD         configure for building on BUILD [BUILD=HOST]'
  388.     echo ' --host=HOST         configure for HOST [determined via config.guess]'
  389.     echo ' --norecursion         configure this directory only [recurse]'
  390.     echo ' --program-prefix=FOO     prepend FOO to installed program names [""]'
  391.     echo ' --program-suffix=FOO     append FOO to installed program names [""]'
  392.     echo ' --program-transform-name=P transform installed names by sed pattern P [""]'
  393.     echo ' --site=SITE         configure with site-specific makefile for SITE'
  394.     echo ' --srcdir=DIR         find the sources in DIR [. or ..]'
  395.     echo ' --target=TARGET     configure for TARGET [TARGET=HOST]'
  396.     echo ' --tmpdir=TMPDIR     create temporary files in TMPDIR [/tmp]'
  397.     echo ' --nfp             configure for software floating point [hard float]'
  398.     echo ' --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)'
  399.     echo ' --without-FOO         package FOO is NOT available'
  400.     echo ' --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)'
  401.     echo ' --disable-FOO         do not include feature FOO'
  402.     echo
  403.     echo 'Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.'
  404.     echo
  405.     if [ -r config.status ] ; then
  406.         cat config.status
  407.     fi
  408.  
  409.     exit 1
  410. fi
  411.  
  412. configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
  413. moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
  414.  
  415. # this is a hack.  sun4 must always be a valid host alias or this will fail.
  416. if ${configsub} sun4 >/dev/null 2>&1 ; then
  417.         true
  418. else
  419.         echo '***' cannot find config.sub.  1>&2
  420.         exit 1
  421. fi
  422.  
  423. touch config.junk
  424. if ${moveifchange} config.junk config.trash ; then
  425.         true
  426. else
  427.         echo '***' cannot find move-if-change.  1>&2
  428.         exit 1
  429. fi
  430. rm -f config.junk config.trash
  431.  
  432. case "${srcdir}" in
  433. "")
  434.         if [ -r configure.in ] ; then
  435.                 srcdir=.
  436.         else
  437.                 if [ -r ${progname}.in ] ; then
  438.                         srcdir=`echo ${progname} | sed 's:/configure$::'`
  439.                 else
  440.                         echo '***' "Can't find configure.in.  Try using --srcdir=some_dir"  1>&2
  441.                         exit 1
  442.                 fi
  443.         fi
  444.         ;;
  445. *) ;;
  446. esac
  447.  
  448. ### warn about some conflicting configurations.
  449.  
  450. case "${srcdir}" in
  451. ".") ;;
  452. *)
  453.         if [ -f ${srcdir}/config.status ] ; then
  454.                 echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2
  455.                 exit 1
  456.         fi
  457. esac
  458.  
  459. # default exec_prefix
  460. case "${exec_prefixoption}" in
  461. "") exec_prefix="\$(prefix)" ;;
  462. *) ;;
  463. esac
  464.  
  465. ### break up ${srcdir}/configure.in.
  466. case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
  467. "")
  468.         echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2
  469.         exit 1
  470.         ;;
  471. *) ;;
  472. esac
  473.  
  474. case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
  475. "")
  476.         echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2
  477.         exit 1
  478.         ;;
  479. *) ;;
  480. esac
  481.  
  482. case "${TMPDIR}" in
  483. "") TMPDIR=/tmp ; export TMPDIR ;;
  484. *) ;;
  485. esac
  486.  
  487. # keep this filename short for &%*%$*# 14 char file names
  488. tmpfile=${TMPDIR}/cONf$$
  489. # Note that under many versions of sh a trap handler for 0 will *override* any
  490. # exit status you explicitly specify!  At this point, the only non-error exit
  491. # is at the end of the script; these actions are duplicated there, minus
  492. # the "exit 1".  Don't use "exit 0" anywhere after this without resetting the
  493. # trap handler, or you'll lose.
  494. trap "rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos; exit 1" 0 1 2 15
  495.  
  496. # split ${srcdir}/configure.in into common, per-host, per-target,
  497. # and post-target parts.  Post-target is optional.
  498. sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
  499. sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
  500. if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
  501.   sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
  502.   sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
  503. else
  504.   sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
  505.   echo >${tmpfile}.pos
  506. fi
  507.  
  508. ### do common part of configure.in
  509.  
  510. . ${tmpfile}.com
  511.  
  512. # some sanity checks on configure.in
  513. case "${srctrigger}" in
  514. "")
  515.         echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in.  1>&2
  516.         exit 1
  517.         ;;
  518. *) ;;
  519. esac
  520.  
  521. case "${build_alias}" in
  522. "")    ;;
  523. *)
  524.     if result=`${config_shell} ${configsub} ${build_alias}` ; then
  525.         buildopt="--build=${build_alias}"
  526.         build_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  527.         build_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  528.         build_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  529.         build=${build_cpu}-${build_vendor}-${build_os}
  530.     else
  531.         echo "Unrecognized build system name ${build_alias}." 1>&2
  532.         exit 1
  533.     fi
  534.     ;;
  535. esac
  536.  
  537. if result=`${config_shell} ${configsub} ${host_alias}` ; then
  538.     true
  539. else
  540.     echo "Unrecognized host system name ${host_alias}." 1>&2
  541.     exit 1
  542. fi
  543. host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  544. host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  545. host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  546. host=${host_cpu}-${host_vendor}-${host_os}
  547.  
  548. . ${tmpfile}.hst
  549.  
  550. if result=`${config_shell} ${configsub} ${target_alias}` ; then
  551.     true
  552. else
  553.     echo "Unrecognized target system name ${target_alias}." 1>&2
  554.     exit 1
  555. fi
  556. target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  557. target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  558. target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  559. target=${target_cpu}-${target_vendor}-${target_os}
  560.  
  561. . ${tmpfile}.tgt
  562.  
  563. # Find the source files, if location was not specified.
  564. case "${srcdir}" in
  565. "")
  566.         srcdirdefaulted=1
  567.         srcdir=.
  568.         if [ ! -r ${srctrigger} ] ; then
  569.                 srcdir=..
  570.         fi
  571.         ;;
  572. *) ;;
  573. esac
  574.  
  575. if [ ! -r ${srcdir}/${srctrigger} ] ; then
  576.         case "${srcdirdefaulted}" in
  577.         "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;;
  578.         *)  echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;;
  579.         esac
  580.  
  581.         echo '***' \(At least ${srctrigger} is missing.\) 1>&2
  582.         exit 1
  583. fi
  584.  
  585. # Some systems (e.g., one of the i386-aix systems the gas testers are
  586. # using) don't handle "\$" correctly, so don't use it here.
  587. tooldir='$(exec_prefix)'/${target_alias}
  588.  
  589. if [ "${host_alias}" != "${target_alias}" ] ; then
  590.     if [ "${program_prefixoption}" = "" ] ; then
  591.         if [ "${program_suffixoption}" = "" ] ; then 
  592.             if [ "${program_transform_nameoption}" = "" ] ; then
  593.                 program_prefix=${target_alias}- ;
  594.             fi
  595.         fi
  596.     fi
  597. fi
  598.  
  599. # Merge program_prefix and program_suffix onto program_transform_name
  600. # Use a double $ so that make ignores it
  601. if [ "${program_suffix}" != "" ] ; then
  602.     program_transform_name="-e s,\$\$,${program_suffix}, ${program_transform_name}"
  603. fi
  604.  
  605. if [ "${program_prefix}" != "" ] ; then
  606.     program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
  607. fi
  608.  
  609. for subdir in . ${subdirs} ; do
  610.  
  611.     # ${subdir} is relative path from . to the directory we're currently
  612.     # configuring.
  613.     # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
  614.     invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
  615.  
  616.     ### figure out what to do with srcdir
  617.     case "${srcdir}" in
  618.         ".")  # no -srcdir option.  We're building in place.
  619.                 makesrcdir=. ;;
  620.         /*) # absolute path
  621.                 makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
  622.                 ;;
  623.         *) # otherwise relative
  624.                 case "${subdir}" in
  625.                 .) makesrcdir=${srcdir} ;;
  626.                 *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;;
  627.                 esac
  628.                 ;;
  629.     esac
  630.  
  631.     if [ "${subdir}/" != "./" ] ; then
  632.         Makefile=${subdir}/Makefile
  633.     fi
  634.  
  635.     if [ ! -d ${subdir} ] ; then
  636.         if mkdir ${subdir} ; then
  637.                 true
  638.         else
  639.                 echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2
  640.                 exit 1
  641.         fi
  642.     fi
  643.  
  644.     case "${removing}" in
  645.     "")
  646.         case "${subdir}" in
  647.         .) ;;
  648.         *) eval echo Building in ${subdir} ${redirect} ;;
  649.         esac
  650.  
  651.         # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
  652.         # Set up the list of links to be made.
  653.         # ${links} is the list of link names, and ${files} is the list of names to link to.
  654.  
  655.         # Make the links.
  656.         configlinks="${links}"
  657.         if [ -r ${subdir}/config.status ] ; then
  658.                 mv -f ${subdir}/config.status ${subdir}/config.back
  659.         fi
  660.         while [ -n "${files}" ] ; do
  661.                 # set file to car of files, files to cdr of files
  662.                 set ${files}; file=$1; shift; files=$*
  663.                 set ${links}; link=$1; shift; links=$*
  664.  
  665.                 if [ ! -r ${srcdir}/${file} ] ; then
  666.                         echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
  667.                         echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
  668.                         exit 1
  669.                 fi
  670.  
  671.                 ${remove} -f ${link}
  672.         # Make a symlink if possible, otherwise try a hard link
  673.         if ${symbolic_link} ${srcdir}/${file} ${link} >/dev/null 2>&1 ; then
  674.             true
  675.         else
  676.             # We need to re-remove the file because Lynx leaves a 
  677.             # very strange directory there when it fails an NFS symlink.
  678.             ${remove} -r -f ${link}
  679.             ${hard_link} ${srcdir}/${file} ${link}
  680.         fi
  681.                 if [ ! -r ${link} ] ; then
  682.                         echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
  683.                         exit 1
  684.                 fi
  685.  
  686.                 echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
  687.         done
  688.  
  689.         # Create a .gdbinit file which runs the one in srcdir
  690.         # and tells GDB to look there for source files.
  691.  
  692.         if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then
  693.                 case ${srcdir} in
  694.                 .) ;;
  695.                 *) cat > ${subdir}/.gdbinit <<EOF
  696. # ${NO_EDIT}
  697. dir ${makesrcdir}
  698. dir .
  699. source ${makesrcdir}/.gdbinit
  700. EOF
  701.                         ;;
  702.                 esac
  703.         fi
  704.  
  705.         # Install a makefile, and make it set VPATH
  706.         # if necessary so that the sources are found.
  707.         # Also change its value of srcdir.
  708.         # NOTE: Makefile generation constitutes the majority of the time in configure.  Hence, this section has
  709.         # been somewhat optimized and is perhaps a bit twisty.
  710.  
  711.         # code is order so as to try to sed the smallest input files we know.
  712.  
  713.         # the four makefile fragments MUST end up in the resulting Makefile in this order: 
  714.         # package, target, host, and site.  so do these separately because I don't trust the
  715.         #  order of sed -e expressions.
  716.  
  717.         if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
  718.  
  719.             # Conditionalize for this site from "Makefile.in" (or whatever it's called) into Makefile.tem
  720.             rm -f ${subdir}/Makefile.tem
  721.               case "${site}" in
  722.               "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;;
  723.               *)
  724.                       site_makefile_frag=${srcdir}/config/ms-${site}
  725.  
  726.                       if [ -f ${site_makefile_frag} ] ; then
  727.                               sed -e "/^####/  r ${site_makefile_frag}" ${srcdir}/${subdir}/${Makefile_in} \
  728.                                       > ${subdir}/Makefile.tem
  729.                       else
  730.                               cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
  731.                               site_makefile_frag=
  732.                       fi
  733.                       ;;
  734.             esac
  735.             # working copy now in ${subdir}/Makefile.tem
  736.  
  737.             # Conditionalize the makefile for this host.
  738.             rm -f ${Makefile}
  739.             case "${host_makefile_frag}" in
  740.               "") mv ${subdir}/Makefile.tem ${Makefile} ;;
  741.               *)
  742.                       if [ ! -f ${host_makefile_frag} ] ; then
  743.                               host_makefile_frag=${srcdir}/${host_makefile_frag}
  744.                       fi
  745.                       if [ -f ${host_makefile_frag} ] ; then
  746.                               sed -e "/^####/  r ${host_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
  747.                       else
  748.                               echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
  749.                               echo '***' is missing in ${PWD=`pwd`}. 1>&2
  750.                               mv ${subdir}/Makefile.tem ${Makefile}
  751.                       fi
  752.             esac
  753.             # working copy now in ${Makefile}
  754.  
  755.             # Conditionalize the makefile for this target.
  756.             rm -f ${subdir}/Makefile.tem
  757.             case "${target_makefile_frag}" in
  758.               "") mv ${Makefile} ${subdir}/Makefile.tem ;;
  759.               *)
  760.                       if [ ! -f ${target_makefile_frag} ] ; then
  761.                               target_makefile_frag=${srcdir}/${target_makefile_frag}
  762.                       fi
  763.                       if [ -f ${target_makefile_frag} ] ; then
  764.                               sed -e "/^####/  r ${target_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
  765.                       else
  766.                               mv ${Makefile} ${subdir}/Makefile.tem
  767.                               target_makefile_frag=
  768.                       fi
  769.                       ;;
  770.             esac
  771.             # real copy now in ${subdir}/Makefile.tem
  772.  
  773.             # Conditionalize the makefile for this package.
  774.             rm -f ${Makefile}
  775.             case "${package_makefile_frag}" in
  776.               "") mv ${subdir}/Makefile.tem ${Makefile} ;;
  777.               *)
  778.                       if [ ! -f ${package_makefile_frag} ] ; then
  779.                               package_makefile_frag=${srcdir}/${package_makefile_frag}
  780.                       fi
  781.                       if [ -f ${package_makefile_frag} ] ; then
  782.                               sed -e "/^####/  r ${package_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
  783.                   rm -f ${subdir}/Makefile.tem
  784.                       else
  785.                               echo '***' Expected package makefile fragment \"${package_makefile_frag}\" 1>&2
  786.                               echo '***' is missing in ${PWD=`pwd`}. 1>&2
  787.                               mv ${subdir}/Makefile.tem ${Makefile}
  788.                       fi
  789.             esac
  790.             # working copy now in ${Makefile}
  791.  
  792.             mv ${Makefile} ${subdir}/Makefile.tem
  793.  
  794.             # real copy now in ${subdir}/Makefile.tem
  795.  
  796.             # prepend warning about editting, and a bunch of variables.
  797.             rm -f ${Makefile}
  798.             cat > ${Makefile} <<EOF
  799. # ${NO_EDIT}
  800. VPATH = ${makesrcdir}
  801. links = ${configlinks}
  802. host_alias = ${host_alias}
  803. host_cpu = ${host_cpu}
  804. host_vendor = ${host_vendor}
  805. host_os = ${host_os}
  806. host_canonical = ${host_cpu}-${host_vendor}-${host_os}
  807. target_alias = ${target_alias}
  808. target_cpu = ${target_cpu}
  809. target_vendor = ${target_vendor}
  810. target_os = ${target_os}
  811. target_canonical = ${target_cpu}-${target_vendor}-${target_os}
  812. EOF
  813.         case "${build}" in
  814.           "") ;;
  815.           *)  cat >> ${Makefile} << EOF
  816. build_alias = ${build_alias}
  817. build_cpu = ${build_cpu}
  818. build_vendor = ${build_vendor}
  819. build_os = ${build_os}
  820. build_canonical = ${build_cpu}-${build_vendor}-${build_os}
  821. EOF
  822.         esac
  823.  
  824.             case "${package_makefile_frag}" in
  825.               "") ;;
  826.               /*) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
  827.               *)  echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;;
  828.             esac
  829.  
  830.             case "${target_makefile_frag}" in
  831.               "") ;;
  832.               /*) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
  833.               *)  echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;;
  834.             esac
  835.  
  836.             case "${host_makefile_frag}" in
  837.               "") ;;
  838.               /*) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
  839.               *)  echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;;
  840.             esac
  841.  
  842.             if [ "${site_makefile_frag}" != "" ] ; then
  843.                 echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
  844.             fi 
  845.  
  846.         # make sure that some sort of reasonable default exists for these 
  847.         # two variables
  848.         CXX=${CXX-"g++ -O"}
  849.         CC=${CC-cc}
  850.  
  851.             # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
  852.             # remove any form feeds.
  853.             if [ -z "${subdirs}" ]; then
  854.                 rm -f ${subdir}/Makefile.tem2
  855.                 sed -e "s:^SUBDIRS[     ]*=.*$:SUBDIRS = ${configdirs}:" \
  856.                     -e "s:^NONSUBDIRS[     ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
  857.                     ${subdir}/Makefile.tem > ${subdir}/Makefile.tem2
  858.                 rm -f ${subdir}/Makefile.tem
  859.                 mv ${subdir}/Makefile.tem2 ${subdir}/Makefile.tem
  860.             fi
  861.             sed -e "s:^prefix[     ]*=.*$:prefix = ${prefix}:" \
  862.                     -e "s:^exec_prefix[     ]*=.*$:exec_prefix = ${exec_prefix}:" \
  863.             -e "s:^SHELL[     ]*=.*$:SHELL = ${config_shell}:" \
  864.                     -e "s:^srcdir[     ]*=.*$:srcdir = ${makesrcdir}:" \
  865.                     -e "s/ //" \
  866.                     -e "s:^program_prefix[     ]*=.*$:program_prefix = ${program_prefix}:" \
  867.                     -e "s:^program_suffix[     ]*=.*$:program_suffix = ${program_suffix}:" \
  868.                     -e "s:^program_transform_name[     ]*=.*$:program_transform_name = ${program_transform_name}:" \
  869.                     -e "s:^tooldir[     ]*=.*$:tooldir = ${tooldir}:" \
  870.                     ${subdir}/Makefile.tem >> ${Makefile}
  871.             # final copy now in ${Makefile}
  872.  
  873.         else
  874.            echo "No Makefile.in found in ${srcdir}/${subdir}, unable to configure" 1>&2
  875.         fi
  876.  
  877.         rm -f ${subdir}/Makefile.tem
  878.  
  879.         case "${host_makefile_frag}" in
  880.         "") using= ;;
  881.         *) using="and \"${host_makefile_frag}\"" ;;
  882.         esac
  883.  
  884.         case "${target_makefile_frag}" in
  885.         "") ;;
  886.         *) using="${using} and \"${target_makefile_frag}\"" ;;
  887.         esac
  888.  
  889.         case "${site_makefile_frag}" in
  890.         "") ;;
  891.         *) using="${using} and \"${site_makefile_frag}\"" ;;
  892.         esac
  893.  
  894.         newusing=`echo "${using}" | sed 's/and/using/'`
  895.         using=${newusing}
  896.         echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
  897.  
  898.         . ${tmpfile}.pos
  899.  
  900.         # describe the chosen configuration in config.status.
  901.         # Make that file a shellscript which will reestablish
  902.         # the same configuration.  Used in Makefiles to rebuild
  903.         # Makefiles.
  904.  
  905.         case "${norecursion}" in
  906.         "") arguments="${arguments} --norecursion" ;;
  907.         *) ;;
  908.         esac
  909.  
  910.         if [ ${subdir} = . ] ; then
  911.             echo "#!/bin/sh
  912. # ${NO_EDIT}
  913. # This directory was configured as follows:
  914. ${progname}" ${arguments}  "
  915. # ${using}" > ${subdir}/config.new
  916.         else
  917.             echo "#!/bin/sh
  918. # ${NO_EDIT}
  919. # This directory was configured as follows:
  920. cd ${invsubdir}
  921. ${progname}" ${arguments}  "
  922. # ${using}" > ${subdir}/config.new
  923.         fi
  924.         chmod a+x ${subdir}/config.new
  925.         if [ -r ${subdir}/config.back ] ; then
  926.                 mv -f ${subdir}/config.back ${subdir}/config.status
  927.         fi
  928.         ${moveifchange} ${subdir}/config.new ${subdir}/config.status
  929.         ;;
  930.  
  931.     *)  rm -f ${Makefile} ${subdir}/config.status ${links} ;;
  932.     esac
  933. done
  934.  
  935. # If there are subdirectories, then recur. 
  936. if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then 
  937.         for configdir in ${configdirs} ; do
  938.  
  939.                 if [ -d ${srcdir}/${configdir} ] ; then
  940.                         eval echo Configuring ${configdir}... ${redirect}
  941.                         case "${srcdir}" in
  942.                         ".") ;;
  943.                         *)
  944.                                 if [ ! -d ./${configdir} ] ; then
  945.                                         if mkdir ./${configdir} ; then
  946.                                                 true
  947.                                         else
  948.                                                 echo '***' "${progname}: could not make ${PWD=`pwd`}/${configdir}" 1>&2
  949.                                                 exit 1
  950.                                         fi
  951.                                 fi
  952.                                 ;;
  953.                         esac
  954.  
  955.                         POPDIR=${PWD=`pwd`}
  956.                         cd ${configdir} 
  957.  
  958. ### figure out what to do with srcdir
  959.                         case "${srcdir}" in
  960.                         ".") newsrcdir=${srcdir} ;; # no -srcdir option.  We're building in place.
  961.                         /*) # absolute path
  962.                                 newsrcdir=${srcdir}/${configdir}
  963.                                 srcdiroption="--srcdir=${newsrcdir}"
  964.                                 ;;
  965.                         *) # otherwise relative
  966.                                 newsrcdir=../${srcdir}/${configdir}
  967.                                 srcdiroption="--srcdir=${newsrcdir}"
  968.                                 ;;
  969.                         esac
  970.  
  971. ### check for guested configure, otherwise fix possibly relative progname
  972.                         if [ -f ${newsrcdir}/configure ] ; then
  973.                                 recprog=${newsrcdir}/configure
  974.                         elif [ -f ${newsrcdir}/configure.in ] ; then
  975.                                 case "${progname}" in
  976.                                 /*)     recprog=${progname} ;;
  977.                                 *)      recprog=../${progname} ;;
  978.                                 esac
  979.             else
  980.                 eval echo No configuration information in ${configdir} ${redirect}
  981.                 recprog=
  982.                         fi
  983.  
  984. ### The recursion line is here.
  985.             if [ ! -z "${recprog}" ] ; then
  986.                             if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} \
  987.                                     ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
  988.                                     ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${removing} ${other_options} ${redirect} ; then
  989.                                     true
  990.                             else
  991.                     echo Configure in `pwd` failed, exiting. 1>&2
  992.                                     exit 1
  993.                             fi
  994.             fi
  995.  
  996.                         cd ${POPDIR}
  997.                 fi
  998.         done
  999. fi
  1000.  
  1001. # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
  1002. # and reset the trap handler.
  1003. rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
  1004. trap 0
  1005.  
  1006. exit 0
  1007.  
  1008. #
  1009. # Local Variables:
  1010. # fill-column: 131
  1011. # End:
  1012. #
  1013.  
  1014. # end of configure
  1015.